import 'package:flutter/material.dart';
import 'package:ton_demo/calendar/controllers/clean_calendar_controller.dart';
import 'package:ton_demo/calendar/scrollable_clean_calendar.dart';
import 'package:ton_demo/calendar/utils/enums.dart';

class TimePage extends StatelessWidget {

  const TimePage({
    super.key,
    required this.minDate,
    required this.maxDate,
    required this.type,
    required this.haveDataTimeList,
    required this.getSelectedData,
  });

  final DateTime minDate;
  final DateTime maxDate;
  final ViewType type;
  final List<DateTime> haveDataTimeList;
  final Function(DateTime begin, DateTime end) getSelectedData;

  @override
  Widget build(BuildContext context) {
    return ScrollableCleanCalendar(
      monthTextAlign: TextAlign.start,
      calendarController: CleanCalendarController(
        minDate: minDate,
        maxDate: maxDate,
        type: type,
        getSelectedData:getSelectedData,
        /// 有数据的时间列表
        haveDataTimeList: haveDataTimeList,
      ),
      calendarCrossAxisSpacing: 0,
      daySelectedBackgroundColor: Colors.lightBlue,
      daySelectedBackgroundColorBetween: Colors.lightBlue.withOpacity(.3),
    );
  }
}
